import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-04-21
 * Time: 17:52
 */
public class Classify {
    public static void ran(int[] arr) {
        int left = 0;
        int right = arr.length - 1;
        while(left < right) {
            while(arr[left] % 2 != 0&&left < right) {
                left++;
            }
            while(arr[right] % 2 == 0&&left < right) {
                right--;
            }
            swap(arr,left,right);
        }
    }
    public static void swap(int[] arr,int a,int b) {
        int tem = 0;
        tem = arr[a];
        arr[a] = arr[b];
        arr[b] = tem;
    }

    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9};
        ran(arr);
        System.out.println(Arrays.toString(arr));
    }
}
